<?php


namespace app\home\controller;


use app\common\controller\BaseController;
use app\home\model\Member as memberModel;
use think\App;

class Member extends BaseController
{
    protected $model;

    public function __construct(App $app, memberModel $member)
    {
        parent::__construct($app);
        $this->model = $member;
    }

    /**
     * @return mixed
     * 用户详情
     */
    public function read()
    {
        return $this->model->getOne($this->params);
    }

    /**
     * @return mixed
     * 领取任务
     */
    public function addTask()
    {
        return $this->model->getTask($this->params);
    }

    /**
     * @return array
     * 任务提交
     */
    public function post()
    {
        try {
            return $this->model->postTask($this->params);
        } catch (\Exception $ex) {
            return $this->returnException($ex);
        }
    }

    /**
     * @return mixed
     * 我的兑换记录
     */
    public function myExchange()
    {
        return $this->model->getMyExchange($this->params);
    }

    /**
     * @return array|void
     * 绑定手机号
     */
    public function bindPhone()
    {
        try {
            return $this->model->bind($this->params);
        } catch (\Exception $ex) {
            return $this->model->returnException($ex);
        }
    }
}